<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加平台</title>
    <script src="./js/vue.min.js"></script>
    <script src="./js/vue-resource.js"></script>
    <link rel="stylesheet" href="./editor.md-master/css/editormd.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/addnews.css"/>
</head>
<body>

<div id="form">
    <form action="/addplatform" method="post" enctype="multipart/form-data">
        <a class="title">平台名称:</a>  <input class="input" type="text" placeholder="平台名称" name="name"><br>
        <a class="title">平台官网:</a>  <input class="input" type="text" placeholder="平台官网" name="platformurl"><br>
        <a class="title">交易量:</a>  <input class="input" type="text" placeholder="交易量" name="tradingVolume"><br>
        <a class="title">创办日期:</a>  <input class="input" type="text" placeholder="创办日期" name="foundDate"><br>
        <a class="title">平台评级:</a>  <input class="input" type="text" placeholder="平台评级" name="level"><br>

        <img id="preview" />
        <br />
        <input class="input" id="coinimage" type="file" name="image" onchange="imgPreview(this)"><br>
        <div id="test-editormd">
            <textarea style="display:none;" id="ts" name="des"></textarea>
        </div>
        <input class="input" type="text"  name="deviceType" value="web" hidden="true">
        <button class="but" type="submit">提  交</button>
    </form>
</div>

<!--<script src="./js/addcoinsdes/addcoinsdes.js"></script>-->
<script src="./editor.md-master/examples/js/jquery.min.js"></script>
<script src="./editor.md-master/editormd.js"></script>
<script type="text/javascript">
    var testEditor;
    $(function() {
        testEditor = editormd("test-editormd", {
            width   : "90%",
            height  : 640,
            syncScrolling : "single",
            path    : "./editor.md-master/lib/"
        });
    });

    function imgPreview(fileDom){
        //判断是否支持FileReader
        if (window.FileReader) {
            var reader = new FileReader();
        } else {
            alert("您的设备不支持图片预览功能，如需该功能请升级您的设备！");
        }

        //获取文件
        var file = fileDom.files[0];
        var imageType = /^image\//;
        //是否是图片
        if (!imageType.test(file.type)) {
            alert("请选择图片！");
            return;
        }
        //读取完成
        reader.onload = function(e) {
            //获取图片dom
            var img = document.getElementById("preview");
            //图片路径设置为读取的图片
            img.src = e.target.result;
        };
        reader.readAsDataURL(file);
    }

</script>
</body>
</html>